/*----------------------------------------------------------------------------*/
/* Team 3647
/* PSoC.java
/* PSoC methods for I/O
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStationEnhancedIO;

public class PSoC {

    private static DriverStationEnhancedIO io = DriverStation.getInstance().getEnhancedIO();

    public static boolean getDigital(int port) {
        try {                                 //You need to catch an exception
            return io.getDigital(port);       //Return the state of the digital input
        } catch (Exception e) {               //An exception will be thrown if the board is not plugged in
            //e.printStackTrace();            //If an exception is thrown, print exception data
            return false;                     //and return false
        }
    }

    public static double getAnalog(int port) {
        try {                                 //You need to catch an exception
            return io.getAnalogIn(port);
        } catch (Exception e) {               //An exception will be thrown if the board is not plugged in
            //e.printStackTrace();            //If an exception is thrown, print exception data
            return -1;                        //and return -1
        }
    }
}
